<admintpl file="header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">会员卡列表</a></li>
        <li><a href="{:U('add')}">新增卡</a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('lists')}">
        标题：
        <input type="text" name="title" style="width: 120px;" value="{$formget.title}" placeholder="">
        类型：
        <select style="" id="category_id" name="inf_type">
            <option value="0">全部</option>
            {$options}
        </select>
        <input type="submit" style="margin-left: 5px;" class="btn btn-primary" value="搜索"/>
    </form>


    <!--<a data-toggle="modal" data-target="#myModal"  class="btn btn-primary" >添加</a>-->

    <table style="margin-top: 10px;word-break:break-all;" class="table table-hover table-bordered table-list"
           id="menus-table">
        <thead>
        <tr>
            <th>序号</th>
            <th>分类</th>
            <th>次数/有效天数</th>
            <th>价格</th>
            <th>编辑时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
            <volist name="list" id="vo" key="k">
                <tr>
                    <td>{$k}</td>
                    <td>
                        <if condition="$vo['type'] eq 'times'">
                            次数卡
                            <else/>
                            时长卡
                        </if>

                    </td>
                    <td>{$vo.number}</td>
                    <td>{$vo.price}</td>
                    <td>{$vo.update_time}</td>
                    <td><a href="{:U('edit', ['id' => $vo['id']])}">编辑</a> | <a class="js-ajax-delete" href="{:U('del', ['id' => $vo['id']])}">删除</a></td>
                </tr>
            </volist>
        </tbody>
    </table>
    <div class="pagination">{$Page}</div>
</div>
<div>
    <!--添加-->
    <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">添加</h3>
        </div>
        <form action="{:U('add')}" method="post"
              class="form-horizontal js-ajax-form">
            <input type="hidden" name="tag" class="" value="{$tag}">
            <div class="modal-body">
                <table>
                    <tbody>
                    <tr>
                        <th style="width: 100px;">类型：</th>
                        <td>

                            <select style="" id="" name="post[type]">
                                <!--<option value="0">&#45;&#45;请选择&#45;&#45;</option>-->
                                <option value="times">次数卡</option>
                                <option value="period">时长卡</option>
                            </select>
                        </td>
                    </tr>


                    <tr>
                        <th style="white-space:nowrap;">次数/天数：</th>
                        <td><input type="text" name="post[number]" required id="" value="" style="width: 400px">
                            <span class="form-required">*</span>
                        </td>
                    </tr>
                    <tr>
                        <th style="white-space:nowrap;">价格：</th>
                        <td><input type="text" name="post[price]" required id="" value="" style="width: 400px">
                            <span class="form-required">*</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                <button type="submit" class="btn btn-primary ">保存</button>
            </div>
        </form>
    </div>

    <!--编辑-->
    <div id="myModal_2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">编辑</h3>
        </div>
        <form action="{:U('edit')}" method="post"
              class="form-horizontal js-ajax-form">
            <div class="modal-body">
                <table>
                    <tbody>
                        <tr>
                            <th style="width: 100px;">类型：</th>
                            <td>

                                <select style="" id="" name="post[type]">
                                    <!--<option value="0">&#45;&#45;请选择&#45;&#45;</option>-->
                                    <option value="times">次数卡</option>
                                    <option value="period">时长卡</option>
                                </select>
                            </td>
                        </tr>


                    <tr>
                        <th style="white-space:nowrap;">次数/天数：</th>
                        <td><input type="text" name="post[number]" required id="name" value="" style="width: 400px">
                            <span class="form-required">*</span>
                        </td>
                    </tr>
                    <tr>
                        <th style="white-space:nowrap;">价格：</th>
                        <td><input type="text" name="post[price]" required id="" value="" style="width: 400px">
                            <span class="form-required">*</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
                <button type="submit" class="btn btn-primary ">保存</button>
            </div>
        </form>
    </div>
    <script src="__PUBLIC__/js/common.js"></script>
    <script>
        $(".hidden").hide();
        $('.add_ext').click(function () {
            var name = $(this).attr("name");
            var id = $(this).attr("tid");
            var sort = $(this).attr("sort");

            $(".id").val(id);
            // $("#id").val(id);
            $("#name").val(name);
            $("#sort").val (sort);
        });

    </script>
</body>
</html>